Micron Document
πŸŽ–οΈGitΠ―Ρ€Π°πŸŽ–οΈ


Displaying Raw β€’ View rendered β€’ Download

core/barcode/README.md renovate/net.java.dev.jna-jna-5.x (5a8f4966) Text, 2.74 KB

Tc9d1d9# `:core:barcode`

Tc9d1d9## Overview
The Ta5d6ff`:core:barcode` module provides barcode and QR code scanning capabilities using CameraX and flavor-specific decoding engines. It is used for scanning node configuration, pairing, and contact sharing.

The shared contract (Ta5d6ff`BarcodeScanner` interface + Ta5d6ff`LocalBarcodeScannerProvider`) lives in Ta5d6ff`core:ui/commonMain`, keeping this module Android-only.

Tc9d1d9## Key Components

Tc9d1d9### 1. `rememberBarcodeScanner`
A Composable function (in Ta5d6ff`main/`) that provides camera permission handling, a full-screen scanner dialog with live preview and reticule overlay, and returns a Ta5d6ff`BarcodeScanner` instance.

Tff7b72- **Technology:** Uses **CameraX** for camera lifecycle management.
Tff7b72- **Flavors:** Barcode decoding is the only flavor-specific code:
Tff7b72- Ta5d6ff`google/` β€” **ML Kit** (Ta5d6ff`BarcodeScanning` + Ta5d6ff`InputImage`) via Ta5d6ff`createBarcodeAnalyzer()`
Tff7b72- Ta5d6ff`fdroid/` β€” **ZXing** (Ta5d6ff`MultiFormatReader` + Ta5d6ff`PlanarYUVLuminanceSource`) via Ta5d6ff`createBarcodeAnalyzer()`
Tff7b72- All shared UI (dialog, reticule, permissions, camera lifecycle) lives in Ta5d6ff`main/`.

Tc9d1d9## Source Layout

Ta5d6ff```
src/
β”œβ”€β”€ main/ BarcodeScannerProvider.kt (shared UI)
β”œβ”€β”€ google/ BarcodeAnalyzerFactory.kt (ML Kit decoder)
β”œβ”€β”€ fdroid/ BarcodeAnalyzerFactory.kt (ZXing decoder)
β”œβ”€β”€ test/ Unit tests
└── androidTest/ Instrumented tests
```

Tc9d1d9## Usage

Ta5d6ff```Ta5d6ffkotlin
T8b949e// In a Composable (typically wired via LocalBarcodeScannerProvider in androidApp/)
Tff7b72val Te6edf3scanner Tff7b72= Te6edf3rememberBarcodeScanner Tb4b4b4{ Te6edf3result Tff7b72-Tff7b72>
T8b949e// Handle scanned QR code string (or null on dismiss)
Tb4b4b4}
Te6edf3scannerTb4b4b4.Te6edf3startScanTb4b4b4(Tb4b4b4)
Ta5d6ff```

Tc9d1d9## Module dependency graph

<!--region graph-->
Ta5d6ff```Ta5d6ffmermaid
Ta5d6ffgraph TB
:core:barcode[barcode]:::android-library
:core:barcode -.-> :core:resources
:core:barcode -.-> :core:ui

classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-application-compose fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef compose-desktop-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-library-compose fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-library-compose fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-library fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;

Ta5d6ff```
<!--endregion-->

Served by rngit 1.5.0 - Generated in 0.04s